package com.ktgj.service.controller;

import java.util.List;
import java.io.IOException;
import javax.servlet.http.HttpServletResponse;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import com.ktgj.common.log.annotation.Log;
import com.ktgj.common.log.enums.BusinessType;
import com.ktgj.common.security.annotation.PreAuthorize;
import com.ktgj.service.domain.JtViphall;
import com.ktgj.service.service.IJtViphallService;
import com.ktgj.common.core.web.controller.BaseController;
import com.ktgj.common.core.web.domain.AjaxResult;
import com.ktgj.common.core.utils.poi.ExcelUtil;
import com.ktgj.common.core.web.page.TableDataInfo;

/**
 * 鲸图厅原始数据Controller
 * 
 * @author ruoyi
 * @date 2021-09-03
 */
@ControllerAdvice
@RestController
@RequestMapping("/jtviphall")
public class JtViphallController extends BaseController
{
    @Autowired
    private IJtViphallService jtViphallService;

    /**
     * 查询鲸图厅原始数据列表
     */
    @PreAuthorize(hasPermi = "service:viphall:list")
    @GetMapping("/list")
    public TableDataInfo list(JtViphall jtViphall)
    {
        startPage();
        List<JtViphall> list = jtViphallService.selectJtViphallList(jtViphall);
        return getDataTable(list);
    }

    /**
     * 导出鲸图厅原始数据列表
     */
    @PreAuthorize(hasPermi = "service:viphall:export")
    @Log(title = "鲸图厅原始数据 ", businessType = BusinessType.EXPORT)
    @PostMapping("/export")
    public void export(HttpServletResponse response, JtViphall jtViphall) throws IOException
    {
        List<JtViphall> list = jtViphallService.selectJtViphallList(jtViphall);
        ExcelUtil<JtViphall> util = new ExcelUtil<JtViphall>(JtViphall.class);
        util.exportExcel(response, list, "鲸图厅原始数据 数据");
    }

    /**
     * 获取鲸图厅原始数据详细信息
     */
    @PreAuthorize(hasPermi = "service:viphall:query")
    @GetMapping(value = "/{id}")
    public AjaxResult getInfo(@PathVariable("id") Long id)
    {
        return AjaxResult.success(jtViphallService.selectJtViphallById(id));
    }

    /**
     * 新增鲸图厅原始数据
     */
    @PreAuthorize(hasPermi = "service:viphall:add")
    @Log(title = "鲸图厅原始数据 ", businessType = BusinessType.INSERT)
    @PostMapping
    public AjaxResult add(@RequestBody JtViphall jtViphall)
    {
        return toAjax(jtViphallService.insertJtViphall(jtViphall));
    }

    /**
     * 修改鲸图厅原始数据
     */
    @PreAuthorize(hasPermi = "service:viphall:edit")
    @Log(title = "鲸图厅原始数据 ", businessType = BusinessType.UPDATE)
    @PutMapping
    public AjaxResult edit(@RequestBody JtViphall jtViphall)
    {
        return toAjax(jtViphallService.updateJtViphall(jtViphall));
    }

    /**
     * 删除鲸图厅原始数据
     */
    @PreAuthorize(hasPermi = "service:viphall:remove")
    @Log(title = "鲸图厅原始数据 ", businessType = BusinessType.DELETE)
	@DeleteMapping("/{ids}")
    public AjaxResult remove(@PathVariable Long[] ids)
    {
        return toAjax(jtViphallService.deleteJtViphallByIds(ids));
    }
}
